package com.itheima.mapper;
import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface ClazzMapper {
    List<Clazz> clazzList(ClazzQueryParam param);

    @Select("select id,name,room,begin_Date,end_Date,master_id,subject,create_time,update_time from clazz")
    public List<Clazz> list() ;

    @Insert("insert into clazz(name,room,begin_Date,end_Date,master_id,subject,create_time,update_time) " +
            "values (#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})" )
    void add(Clazz clazz);
    Clazz selectById(Integer id);

    void update(Clazz clazz);
    @Delete("delete from clazz where id = #{id}")
    void delete(Integer id);
    //查询全部
    List<Clazz> selectAll();
    //统计班级数量
    @MapKey("pos")
    List<Map<String, Object>> getClazzCountOptionData();
    @MapKey("total")
    List<Map> countDegreeData();

}
